Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

retext-porter-stemmer

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

retext-porter-stemmer

Retext implementation of the Porter Stemmer

  • 0.2.5
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-75%
Maintainers
1
Weekly downloads
 
Created
Source

retext-porter-stemmer Build Status Coverage Status

retext implementation of the Porter stemming algorithm.

Installation

npm:

$ npm install retext-porter-stemmer

Component.js:

$ component install wooorm/retext-porter-stemmer

Bower:

$ bower install retext-porter-stemmer

Duo:

var porterStemmer = require('wooorm/retext-porter-stemmer');

Usage

var Retext = require('retext');
var visit = require('retext-visit');
var inspect = require('retext-inspect');
var porterStemmer = require('retext-porter-stemmer');

var retext = new Retext()
    .use(inspect)
    .use(visit)
    .use(porterStemmer)

retext.parse('A simple english sentence.', function (err, tree) {
    tree.visit(tree.WORD_NODE, function (node) {
        console.log(node);
    });
    /**
     * WordNode[1] [data={"stem":"a"}]
     * └─ TextNode: 'A'
     * WordNode[1] [data={"stem":"simpl"}]
     * └─ TextNode: 'simple'
     * WordNode[1] [data={"stem":"english"}]
     * └─ TextNode: 'english'
     * WordNode[1] [data={"stem":"sentenc"}]
     * └─ TextNode: 'sentence'
     */
});

API

None, retext-porter-stemmer automatically detects the stem of each WordNode (using wooorm/stemmer), and stores the stem in node.data.stem.

Performance

On a MacBook Air, retext performs about 11% slower with retext-porter-stemmer.

           retext w/o retext-porter-stemmer
  221 op/s » A paragraph (5 sentences, 100 words)
   24 op/s » A section (10 paragraphs, 50 sentences, 1,000 words)

           retext w/ retext-porter-stemmer
  197 op/s » A paragraph (5 sentences, 100 words)
   20 op/s » A section (10 paragraphs, 50 sentences, 1,000 words)
  • retext-lancaster-stemmer — Same workings, but uses the Lancaster (Paice/Husk) stemming algorithm.

License

MIT © Titus Wormer

Keywords

FAQs

Package last updated on 19 Jan 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc